from datetime import datetime

from sqlalchemy import Integer, Column, String, Enum, DateTime, ForeignKey, Float, Text, PrimaryKeyConstraint, text
from sqlalchemy.orm import relationship

from src.extension.extension_db import db
class ReviewPoint(db.Model):
    """复习知识点表模型"""
    __tablename__ = 'review_points'
    __table_args__ = (
        PrimaryKeyConstraint('review_id', name='review_points_pkey'),
    )

    review_id = Column(Integer, nullable=False, autoincrement=True)
    user_id = Column(Integer, ForeignKey('users.user_id'), nullable=False)
    subject = Column(String(50), nullable=False)
    grade = Column(String(50), nullable=False)
    weak_point = Column(Text, nullable=False)
    review_suggestion = Column(Text, nullable=False)
    created_at = Column(DateTime, nullable=False, server_default=text('CURRENT_TIMESTAMP(0)'))
    updated_at = Column(DateTime, nullable=False, server_default=text('CURRENT_TIMESTAMP(0)'), server_onupdate=text('CURRENT_TIMESTAMP(0)'))

    user = relationship("User", back_populates="review_points")
